 <?php if($_SESSION['Permit']==1)
 { 
   
	$sql =sprintf("select * from tblsection ");
		
 } 

   $kq=mysql_query($sql)or die(mysql_error()); 
?>    
<script type="text/javascript">
  function Delete()
  {	  
  var answer = confirm ("Bạn có chắc là muốn xóa những mục đã chọn?");
if (answer)
{
	document.mylist.submit();
}
  }

  function checkAll(control)
{ field= document.getElementsByName('cid[]');
if(control.checked)
{ 
	for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

else

for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
  
</script>
 
      
 
        	
  
<table  width="100%" align="center">
	<tr>
    	<td colspan="2"><h3>Quản lý chuyên mục</h3></td>
        <td align="right">
        	<a  href="sectiona"title="Add new menu Item" style="margin-right:15px;">
        		<img src="img/Add.png" width="32" height="32" border="none"/>
        	</a> 	
       		<a  style="margin-right:15px;" title="Delete " onclick="Delete()">
				<img src="img/delete.png" width="32" height="32"/>
        	</a>
        </td>
    </tr>
   <tr style="height:30px; color:white;" bgcolor="#008000" >
       <th width="21" ><input type="checkbox" name="toggle"  id="toggle" onclick=" checkAll(this);" /></th>
      <th  >Tên Chuyên Mục</th>
      <th  >Mô tả</th>
      
       
    </tr>
   <form name="mylist" action="sectiond" method="post"> 
    <?php  $i=0;
	while($row=mysql_fetch_assoc($kq))
	{$i++;
		?>
     <tr  bgcolor="<?php if($i%2!=0) echo '#f6f8db';else echo  '#9ff1a1'?>" onmouseover="changeback(this);" onmouseout="changebre(this);">
    	  <td align="center"><input type="checkbox" name="cid[]" value="<?php echo $row['id']?>" /></td>
         <td ><a href="sectione&id=<?php echo $row['id']?>"><?php echo $row['name'];?></a></td>
         <td ><?php echo $row['decription']?></td>
    <?php
	}
	?>
 
      </form> 
   </table>
